<template>
  <div class="product-page-layout">
    <a-video-player />

    <div class="brief">
      <div class="title">
        <div class="name">数据分析行业全景概览</div>
        <div class="collect">
          <img src alt />
          收藏
        </div>
      </div>

      <div class="desc">
        <van-rate v-model="productInfo.star" readonly size="12" color="#FF7002" />
        <span class="score">{{ productInfo.star.toFixed(1) }}</span>
        <span class="divider">|</span>
        <span>{{ productInfo.number }}W人学过</span>
      </div>
    </div>

    <div class="container">
      <van-tabs v-model="active" :border="false" color="#0E5CE4">
        <van-tab name="detail">
          <template #title>
            <span :class="['tab-title', active === 'detail' && 'active-tab']">介绍</span>
          </template>

          <detail />
        </van-tab>

        <van-tab name="catlog">
          <template #title>
            <span :class="['tab-title', active === 'catlog' && 'active-tab']">目录</span>
          </template>

          <catlog />
        </van-tab>

        <van-tab name="comment">
          <template #title>
            <span :class="['tab-title', active === 'comment' && 'active-tab']">评论</span>
          </template>

          <comment />
        </van-tab>

        <van-tab name="relative">
          <template #title>
            <span :class="['tab-title', active === 'relative' && 'active-tab']">相关课程</span>
          </template>

          <relative />
        </van-tab>
      </van-tabs>
    </div>

    <submit-bar @click.native="$router.push({ name:  'cashier', params: { id: '1' } })" />
    <div class="submit-bar-placeholder" />
  </div>
</template>

<script>
import Vue from 'vue'
import { Tab, Tabs, Rate } from 'vant'
import AVideoPlayer from '@/components/AVideoPlayer'
import Detail from './Detail'
import Catlog from './Catlog'
import Comment from './Comment'
import Relative from './Relative'
import SubmitBar from './SubmitBar'

Vue.use(Tab)
  .use(Tabs)
  .use(Rate)

export default {
  components: {
    AVideoPlayer,
    Detail,
    Catlog,
    Comment,
    Relative,
    SubmitBar
  },

  data() {
    return {
      active: 'detail',
      productInfo: {
        name: '',
        star: 4.5,
        number: '3.8'
      }
    }
  }
}
</script>

<style lang="less" scoped>
.product-page-layout {
  .tab-title {
    background-color: #999999;
    background-clip: text;
    color: transparent;
    font-size: 15px;
    transition: 300ms;
  }

  .active-tab {
    background: linear-gradient(to bottom, #679ffc, #0d5ce4);
    background-clip: text;
    font-weight: 500;
    font-size: 17px;
  }

  .submit-bar-placeholder {
    height: 60px;
  }

  .brief {
    background-color: #ffffff;
    padding: 20px 17px 9.5px 17px;

    .title {
      display: flex;
      align-items: center;
      justify-content: space-between;

      .name {
        font-weight: 500;
        font-size: 18px;
        color: #333333;
      }

      .collect {
        width: 68px;
        height: 24px;
        border-radius: 12px;
        border: 0.5px solid #979797;
        color: #979797;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;

        img {
          width: 10.5px;
          height: 8.5px;
          margin-right: 6px;
        }
      }
    }

    .desc {
      margin-top: 10.5px;
      font-size: 10px;
      color: #999999;

      .score {
        margin-left: 6px;
      }

      .divider {
        margin: 0 8px;
      }
    }
  }
}
</style>